/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-20 07:51:37
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-20 15:35:02
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/controller/teacher_attendance_controller.dart';
import 'package:flutter_data_center/model/attendance/teacher_attendance_model.dart';
import 'package:flutter_data_center/screens/attendance/teacher/detail/teacher_detail_attendance_screen.dart';
import 'package:flutter_data_center/utills/color_utils.dart';
import 'package:flutter_data_center/utills/navigator_utils.dart';

class TeacherItem extends StatelessWidget {
  const TeacherItem({Key key, this.teacher, this.controller}) : super(key: key);
  final TeacherAttendanceModel teacher;
  final TeacherAttendanceController controller;

  @override
  Widget build(BuildContext context) => InkWell(
        onTap: () {
          NavigatorUtils.pushPageByFade(
            context: context,
            targetPage: TeacherDetailAttendanceScreen(),
            isReplace: false,
            startMills: 500,
          );
        },
        child: ListTile(
          isThreeLine: false,
          minLeadingWidth: 50,
          leading: Container(
            width: 50,
            height: 50,
            child: ClipOval(
              child: Image.network(
                teacher.avatar,
                fit: BoxFit.cover,
              ),
            ),
          ),
          title: Text(
            teacher.name,
            style: TextStyle(
              color: Colors.black,
              fontSize: 16,
            ),
          ),
          subtitle: Text(
            teacher.time,
            style: TextStyle(
              color: gColor('#6D6D6D'),
              fontSize: 14,
            ),
          ),
          trailing: Text(
            controller.attendanceType[teacher.status],
            style: TextStyle(
              fontSize: 16,
              color: gColor("#FF7C03"),
            ),
          ),
        ),
      );
}
